docs: document the session-scoped routing endpoint for manual use#21
Conversation
Add a "Routing through a session without the CLI" section to the README explaining the /v3/session/<id>/… endpoint that `opper launch` targets: URL shape, sess_<uuid> id validation, tag path segments, bearer auth, a raw curl example, and env-var wiring for OpenAI/Anthropic-shaped agents. Also correct the stale `→ /v3/compat` launch annotations: every launchable agent now routes through /v3/session/<id>/… except Claude Desktop, which still bakes /v3/compat into its persistent GUI profile. Claude-Session: https://claude.ai/code/session_01Dd669tGULj45v4CaKBAvGU
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0aa3a53c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # OpenAI-shaped agents (OpenCode, Hermes, Pi, …) | ||
| export OPENAI_BASE_URL="https://api.opper.ai/v3/session/$SID" | ||
| export OPENAI_API_KEY="$OPPER_API_KEY" |
There was a problem hiding this comment.
Don't document OPENAI_ env vars for these agents*
For the listed OpenAI-shaped agents, users following this manual setup won't actually route through the session URL: the adapters wire OpenCode by rewriting provider.opper.options.baseURL in setSessionBaseUrl (src/agents/opencode.ts), Hermes by writing base_url plus key_env: "OPPER_API_KEY" in writeOpperConfig (src/agents/hermes.ts), and Pi by writing baseUrl/apiKey in setOpperProvider plus exporting OPPER_BASE_URL for the extension (src/agents/pi.ts). I only inspected these adapters, and none of them consume OPENAI_BASE_URL/OPENAI_API_KEY, so the README will mislead users trying to reproduce opper launch manually for the agents named in the comment.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch — confirmed against the adapters. Split the section: env-var clients (generic OpenAI SDKs + Claude Code, which does read ANTHROPIC_BASE_URL/ANTHROPIC_AUTH_TOKEN) vs config-file agents (OpenCode/Hermes/Pi/OpenClaw), which take the base URL from their own provider config rather than OPENAI_* env vars. Fixed in 20de977.
@codex review
The manual "point a client at it" example listed OpenCode, Hermes, and Pi next to OPENAI_BASE_URL/OPENAI_API_KEY, but those adapters take the base URL from their own provider config files, not those env vars. Split the section into env-var clients (generic OpenAI SDKs, Claude Code) and config-file agents (OpenCode, Hermes, Pi, OpenClaw) so the manual setup actually routes. Addresses Codex review feedback. Claude-Session: https://claude.ai/code/session_01Dd669tGULj45v4CaKBAvGU
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20de977d83
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| ## Routing through a session without the CLI | ||
|
|
||
| `opper launch` is a thin convenience wrapper. Under the hood it does one thing: it mints a session id and points the agent's inference base URL at a **session-scoped** Opper endpoint, then lets the agent's own SDK speak its native protocol on top. You can wire this up by hand with any OpenAI-, Responses-, or Anthropic-shaped client — no CLI required. |
There was a problem hiding this comment.
Exclude Claude Desktop from session-launch claim
For opper launch claude-desktop, this is not what happens: claudeDesktop.spawn() ignores routing.baseUrl and writeGatewayProfile() hard-codes OPPER_COMPAT_URL, so Desktop traffic keeps using the persistent /v3/compat profile rather than the freshly minted /v3/session/<id> URL. As written, the blanket opper launch description can make users expect per-launch session grouping and summaries for Claude Desktop even though that adapter is the documented exception.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed — qualified both the Agents intro and the section opener to exclude Claude Desktop (persistent /v3/compat profile, no per-launch session). Fixed in the latest commit.
@codex review
There was a problem hiding this comment.
Codex Review: Didn't find any major issues. Keep it up!
Reviewed commit: 46b01a4037
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The prose claimed every `opper launch` runs inside a fresh session, but Claude Desktop is the documented exception (persistent /v3/compat GUI profile, ignores routing.baseUrl). Qualify both the Agents intro and the session-routing section opener so users don't expect per-launch session grouping for Desktop. Addresses Codex review feedback. Claude-Session: https://claude.ai/code/session_01Dd669tGULj45v4CaKBAvGU
What
Adds a "Routing through a session without the CLI" section to the README, documenting the
/v3/session/<id>/…endpoint thatopper launchtargets under the hood — so users can replicate the routing by hand with any OpenAI-, Responses-, or Anthropic-shaped client.Covers:
https://api.opper.ai/v3/session/<session-id>[/<tag>:<value>…]/<native-path>sess_<uuid>id format (server rejects other forms with400 {"error":"invalid session id"})Authorization: Bearerauthcurlexample andOPENAI_BASE_URL/ANTHROPIC_BASE_URLenv wiringAlso corrects the stale
→ /v3/compatlaunch annotations: every launchable agent now routes through/v3/session/<id>/…at spawn time, except Claude Desktop, which still bakes/v3/compatinto its persistent GUI profile (claude-desktop.ts:238).Verification
Grounded in live probes against the API (not just the client code):
POST /v3/session/<sess_uuid>/chat/completions→200withcost,usage, andmeta.trace_uuid400 {"error":"invalid session id"}/v1/messagesand/responsesroutes confirmed present under the session prefix/team:growth/…) acceptedNote: the
/v3/session/...route is not currently in the public/v3/openapi.yamlspec.Docs-only change.
https://claude.ai/code/session_01Dd669tGULj45v4CaKBAvGU